<template>
	<view>
		<view class="housename" v-for="(item,index) in list" :key="index" @click="assetContTo(item)">
			<!-- <view :class="'left'+item.plan.state">
			</view> -->
			<view class="right">
				<view class="house">
					<text>{{item.plan.planNo}}</text>
					<text class="date">{{item.plan.checkStartTime}}</text>
				</view>
				<!-- {{item.plan.planId}} -->
				<view class="details">
					<view class="housedetails">
						<view class="text">
							<text>{{item.plan.typeText}}区域:</text>
						</view>
						<view class="value">
							<text>{{item.plan.regionIdText}}</text>
						</view>
					</view>
					<view class="housedetails">
						<view class="text">
							<text>{{item.plan.typeText}}状态:</text>
						</view>
						<view class="value">
							<text>{{item.plan.stateText}}</text>
						</view>
					</view>
					<!-- <image class="img" src="../../static/image/Anticipate@2x.png" mode=""></image>-->
					<view v-if="item.plan.type==1">
						<view :class="'img'+item.plan.state"></view>
					</view>
					<view v-else>
						<view v-if="item.plan.state==1"><view class="img1"></view></view>
						<view v-if="item.plan.state==2"><view class="img2"></view></view>
						<view v-if="item.plan.state==3"><view class="img3"></view></view>
						<view v-if="item.plan.state==4"><view class="img5"></view></view>
					</view>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default () {
					return []
				}
			}
		},
		methods: {
			assetContTo(item) {
				// uni.navigateTo({
				// 	url: "/pages/assetInventory/assetCountDetails?planNo=" + item.plan.planNo+'&planId='+ item.plan.planId
				// })
				let id = uni.getStorageSync('id')
				let name = uni.getStorageSync('loginName')
				console.log(JSON.stringify(item))
				this.checkMemberIdArr = item.plan.checkMemberId.split(",")
				const checkPlanNo = item.plan.planNo;
				console.log('checkPlanNo: '+ checkPlanNo); //“2022030013”、“2022030012”这两条记录都是可以点进去盘点的
				this.checkMemberArr = item.plan.checkMember.split(",")
				console.log(this.checkMemberIdArr,this.checkMemberArr)
				for (let i = 0; i < this.checkMemberIdArr.length, i < this.checkMemberArr.length; i++) {
					// console.log(this.checkMemberIdArr[i])
					if (this.checkMemberIdArr[i] == id || this.checkMemberArr[i] == name ||checkPlanNo==='2022030012'||checkPlanNo==='2022030013' ) { //判断是否属于该责任人
						// if (true) {
						uni.navigateTo({
							url: "/pages/assetInventory/assetCountDetails?planNo=" + item.plan.planNo +
								'&planId=' + item.plan.planId + '&typeText=' + item.plan.typeText
						})
						return
					} 
				}
				console.log("您不属于该任务")
					uni.showToast({
						title: '您不属于该任务',
						icon: 'none',
						duration: 700
					});
			},
		}
	}
</script>

<style lang="scss">
	.housename {
		width: 100%;
		height: 210rpx;
		margin-top: 20rpx;
		display: flex;
	}

	.left1 {
		width: 2%;
		height: 210rpx;
		background-color: #007AFF;
	}

	.left2 {
		width: 2%;
		height: 210rpx;
		background-color: #FF615D;
	}

	.left3 {
		width: 2%;
		height: 210rpx;
		background-color: #f4ea2a;
	}

	.left4 {
		width: 2%;
		height: 210rpx;
		background-color: #1afa29;
	}

	.img1 {
		// border: 1rpx solid;
		width: 220rpx;
		height: 150rpx;
		position: absolute;
		margin-top: -17.7%;
		margin-left: 65%;
		background: url(../../static/image/weikaishi@2x.png) no-repeat ;
		background-size: 80%;
	}
	.img2 {
		// border: 1rpx solid;
		width: 220rpx;
		height: 150rpx;
		position: absolute;
		margin-top: -17.7%;
		margin-left: 65%;
		background: url(../../static/image/jinxingzhong@2x.png) no-repeat ;
		background-size: 80%;
	}
	.img3 {
		// border: 1rpx solid;
		width: 220rpx;
		height: 150rpx;
		position: absolute;
		margin-top: -17.7%;
		margin-left: 65%;
		background: url(../../static/image/zantingzhong@2x.png) no-repeat ;
		background-size: 80%;
	}
	.img4 {
		// border: 1rpx solid;
		width: 220rpx;
		height: 150rpx;
		position: absolute;
		margin-top: -17.7%;
		margin-left: 65%;
		background: url(../../static/image/yipandian@2x.png) no-repeat ;
		background-size: 80%;
	}
	.img5 {
		// border: 1rpx solid;
		width: 220rpx;
		height: 150rpx;
		position: absolute;
		margin-top: -17.7%;
		margin-left: 65%;
		background: url(../../static/image/yiluodian.png) no-repeat ;
		background-size: 80%;
	}
	.right {
		padding-left: 20rpx;
		width: 100%;
		background-color: #FFFFFF;
		height: 210rpx;
	}

	.house {
		// border: 1rpx solid;
		display: flex;
		height: 60rpx;
		line-height: 60rpx;
		border-bottom: 1px solid #e8e8e8;
	}


	.date {
		color: #000000;
		font-size: 26rpx;
		margin-left: 30%;
		right: 2%;
	}

	.details {
		height: 119rpx;
	}

	.housedetails {
		margin-top: 35rpx;
		height: 30rpx;
		// font-size:1rpx;
		display: flex;
		// border: 1rpx solid;
	}

	.text {
		font-size: 26rpx;
		color: #959595;
		height: 30rpx;
	}

	.value {
		// border: 1rpx solid;
		padding-left: 2%;
		height: 30rpx;
		width: 79%;
		font-size: 24rpx;
		overflow: hidden;
		color: #959595;
	}
</style>
